import {Component, Input, OnInit} from '@angular/core';
import {Router} from '@angular/router';
import {MatrixFarm} from '../matrix-farm';
import {MatrixTurbine} from '../matrix-turbine';

@Component({
  selector: 'app-matrix-farm',
  templateUrl: './matrix-farm.component.html',
  styleUrls: ['./matrix-farm.component.css']
})
export class MatrixFarmComponent implements OnInit {

  @Input()
  matrixFarm: MatrixFarm;


  device

  constructor(
    private router: Router
  ) {

  }

  ngOnInit() {

  }

  ondblclick(matrixTurbine: MatrixTurbine) {
    switch (matrixTurbine.deviceCategoryId) {
      case 1:
        this.router.navigate(['/monitor/turbdetail', matrixTurbine.farmId, matrixTurbine.deviceId]);
        break;
      case 4:
        this.router.navigate(['/monitor/inverterdetail', matrixTurbine.deviceId]);
        break;
    }
  }
}


